package com.xyw.code.bus.common.feign;

import com.xyw.code.bus.common.entity.form.SendMessageForm;
import com.xyw.code.common.core.entity.vo.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * Created with IntelliJ IDEA.
 * User: xuyiwei
 * Date: 2020/2/19
 * Time: 下午2:56
 * Email: 1328312923@qq.com
 * Description: No Description
 **/
@Component
@FeignClient(name = "bus-center", fallback = SendMessageRemoteApi.SendMessageRemoteApiFallback.class)
public interface SendMessageRemoteApi {

    @PostMapping(value = "/sendMessage",consumes = "application/json")
    Result sendMessage(@RequestBody SendMessageForm sendMessageForm);

    @PostMapping(value = "/dealFail",consumes = "application/json")
    Result dealFail(@RequestBody SendMessageForm sendMessageForm);

    @Component
    class SendMessageRemoteApiFallback implements SendMessageRemoteApi {
        @Override
        public Result sendMessage(SendMessageForm sendMessageForm) {
            return Result.fail();
        }

        @Override
        public Result dealFail(SendMessageForm sendMessageForm) {
            return Result.fail();
        }


    }

}
